package com.boarsoft.flow.demo.make;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.boarsoft.flow.core.bean.ProcessHandler;

public class MakeMoneyHandlerImpl implements ProcessHandler {
	private static final Logger log = LoggerFactory.getLogger(MakeMoneyHandlerImpl.class);

	@Override
	public Object process(String entry, Object data, Throwable e) throws Throwable {
//		if (Math.random() < 0.3D) {
//			throw new Exception("Unknown exception on make money");
//		}
		String userId = (String) data;
		Long d = Math.round(Math.random() * 1000);
		log.info("User {} make money {}", userId, d);
		return d;
	}
}
